import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
    state: {
        // 存储token
        token: localStorage.getItem('ruleForm') ? localStorage.getItem('ruleForm') : '',
        name: '',

    },
    mutations: {
        removeToken() {
            localStorage.removeItem("ruleForm");
        },
        // 修改token，并将token存入localStorage
        changeLogin(state, user) {
            state.token = user.token;
            localStorage.setItem('ruleForm', user.token);
        },
    },
    actions: {},
    modules: {}
})
export default store;
